<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/11/28 0028
 * Time: 17:28
 */

namespace app\api\controller;


use logicmodel\TradeLogic;
use think\Controller;
use think\Request;

class Trade extends Controller
{

    private $tradeLogic;
    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->tradeLogic = new TradeLogic();
    }

    /**
     * 商品市场
     * @param $search
     * @param int $time_order
     * @param int $price_order
     * @param int $page
     * @param int $pagesize
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function tradeGoodsList($search,$time_order=1,$price_order=1,$page=1,$pagesize=10){
        return json($this->tradeLogic->tradeGoodsList($search,$time_order,$price_order,$page,$pagesize));
    }

    /**
     * 交易市场作品列表
     * @param $users_goods_id
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function goodsDetail($users_goods_id){
        return json($this->tradeLogic->goodsDetail($users_goods_id));
    }

    /**
     * 盲盒市场列表
     * @param $search
     * @param int $time_order
     * @param int $price_order
     * @param int $page
     * @param int $pagesize
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function tradeBoxList($search,$time_order=1,$price_order=1,$page=1,$pagesize=10){
        return json($this->tradeLogic->tradeBoxList($search,$time_order,$price_order,$page,$pagesize));
    }

    /**
     * 盲盒详情
     * @param $users_box_id
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function boxDetail($users_box_id){
        return json($this->tradeLogic->boxDetail($users_box_id));
    }
}